declare function
deviceType();
class PreferenceData {
	public constructor() {
	}
	public static setPromotionOpen(value /*设定优惠开关*/) {
		//设定优惠开关 1为开0为关
		SystemManger.setCookie("_GamePromo", value);
	}
	public static getPromotionOpen() {
		//回传优惠开关 1为开0为关
		return SystemManger.getCookie('_GamePromo') || 0;
	}
	public static setSound(value /*设定音效值*/) {
		//设定音效值 1~100
		SystemManger.setCookie("_GameSoundVolumn", value);
	}
	public static getSound() {
		return SystemManger.getCookie('_GameSoundVolumn') || 50;
	}
	public static setSoundSwitch(value) {
		//设定音效開關 1为开0为关
		SystemManger.setCookie("_GameSound", value);
	}
	public static getSoundSwitch() {
		//取得音效開關 1为开0为关
		var test = parseInt(SystemManger.getCookie("_GameSound"));
		if(test==1||test==0){
			 return test;
		} else{
			return this.getSoundDef();
		}
		//return SystemManger.getCookie('_GameSound');
	}
	public static setMusicSwitch(value) {
		//設定音樂開關 1为开0为关
		SystemManger.setCookie("_GameMusic", value);
	}
	public static getMusicSwitch() {
			var test = parseInt(SystemManger.getCookie("_GameMusic"));
		if(test==1||test==0){
			 return test;
		} else{
			return this.getSoundDef();
		}
	}

	//默认开启快速玩法
	public static getFastSwitch() {
		var test = parseInt(SystemManger.getCookie("_GameFast"));
		if (test == 0) return 0;
		return test || 1;
	}
	/**
	 * 设定快速玩法 1为开启 0为关闭
	 */
	public static setFastSwitch(value) {
		SystemManger.setCookie("_GameFast", value);
	}

	//设置自动游戏的参数
   public static setAutoPlayData(value){
	   var json = JSON.stringify(value);
	   SystemManger.setCookie("autoPlay", json);
   }
   //获取自动游戏的数据，如果没有则为空
   public static getAutoPlayData(){
	   var json = SystemManger.getCookie("autoPlay");
	   return JSON.parse(json) || {};
   }

   /**
	* static getSoundDef
	*/
   public static getSoundDef() {
	   	if (deviceType() != "pc") {
			return 0;
		} else {
			return 1;
		}
   }
}